import { CategoryQueryList, CategoryQuery } from "@/type";
import qs from "qs";
import request from "@/utils/request";

export async function getCategoryList(params?: CategoryQueryList) {
    // const res = await axios(`https://mock.apifox.cn/m1/2398938-0-default/api/Categorys?${qs.stringify(params)}`)
    return request.get(`/api/categories?${qs.stringify(params)}`)
}

export async function categoryAdd(params?: CategoryQuery) {
    return request.post('/api/categories', params);
}

export async function categoryDelete(id?: string) {
    return request.delete(`/api/categories/${id}`);
}

export async function getCateoryDetails(id?: string) {
    return request.get(`/api/categories/${id}`);
}

export async function categoryUpdate(id: string, params: CategoryQuery) {
    return request.put(`/api/categories/${id}`, params);
}